package io.lvdaxian.handwriting.shared;

/**
 * 通过 ThreadLocal 实现了父子线程的数据传递
 *
 * @author lihh
 */
public class TheadLocal001_Test {
  public static void main(String[] args) {
    // 主线程
    ThreadLocal<String> local = new ThreadLocal<>();
    local.set("hello");
    ThreadLocal<String> local1 = new ThreadLocal<>();
    local1.set("world");
    
    // 启动子线程
    new Thread(() -> {
      System.out.println(local.get());
    }).start();
  }
}
